<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新建文章</title>
<link rel="stylesheet" href="__PUBLIC__/Css/public.css" />
<link rel="stylesheet" href="__PUBLIC__/Css/css.css" />
<script type="text/javascript" src="__PUBLIC__/Js/jquery.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jquery.form.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jBox/jquery.jBox-2.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/jBox/jquery.jBox-zh-CN.js"></script>
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Js/jBox/Skins2/Blue/jbox.css"/>
<script type="text/javascript" src="__PUBLIC__/Js/ueditor/editor_config.js"></script>  
<script type="text/javascript" src="__PUBLIC__/Js/ueditor/editor_all.js"></script>  
<link rel="stylesheet" href="__PUBLIC__/Js/ueditor/themes/default/ueditor.css" /> 
<script type="text/javascript">
$(function(){
	$("#uploadhide").click(function(){
		$(this).parent().parent().hide();
	});
	$(".uploadb").click(function(){
		$("#uploaddiv").show()
		$("#uploaddiv").css({"top":$(this).offset().top,"left":$(this).offset().left+$(this).outerWidth()});
		$("#uploadf").focus();
		obj=$(this).prev();
	});
	$('#uploadform').ajaxForm({
		beforeSubmit:  checkForm,  // pre-submit callback
		success:       complete,  // post-submit callback
		dataType: 'json'
	});
	function checkForm(){
		//可以在此添加其它判断
	}
	function complete(data){
		$("#uploaddiv").hide();
		if (data.status==1){
			data = data.data;
			$(obj).val(data);
		}else{
			$('#result').html(data.info).show();
		}
	}
});
</script>
</head>

<body bgcolor="#C8C8C6">
<div class="userlist">
	<div class="list_top">
		<div class="left" style="font-size:18px;">新建文章</div>
		<div style="clear:both;"></div>
	</div>
	<div class="list_bottom">
		<div class="article center">
		<form action="__GROUP__/cms/art_insert" method="post" class="list_form">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" style="art_table">
				<tr>
					<td width="150">文章标题</td><td><input type="text" name="title" id="title" /></td>
				</tr>
				<tr>
					<td>文章内容</td><td><SCRIPT id="t_area" type="text/plain" name="content"></SCRIPT></td>
				</tr>
				<tr>
					<td>消息来源</td>
					<td>
						<input type="text" name="from" />
					</td>
				</tr>
				<tr>
					<td>首页显示图片地址</td>
					<td>
						<input type="text" name="imgurl" /><input type="button" value="上传图片" class="uploadb">
					</td>
				</tr>
				<tr>
					<td>首页显示视频地址</td>
					<td>
						<input type="text" name="videourl" />
					</td>
				</tr>
				<tr>
					<td>文章分类</td>
					<td>
						<select name="classid" id="classid">
							<option value="">请选择</option>
							<volist name="class" id="vo">
								<option value="{$vo.id}">{$vo.class_name}</option>
							</volist>
						</select>
					</td>
				</tr>
				<tr>
					<td colspan="10" align="center"><a href="javascript:void(0)" class="button_l"><span class="button_r" id="submit" onclick="checkform()">提交</span></a>
					</td>
				</tr>
			</table>
		</form>
		</div>
	</div>
	<div id="uploaddiv" style="position:absolute;display:none;border:1px solid #ccc;padding:5px;background:#666;">
	<form action="__URL__/upload" method="post" enctype="multipart/form-data" name="uploadform" id="uploadform">
	<input type="button" id="uploadhide" value="关闭" /><br/>
	<input type="file" name="uploadf" id="uploadf" />
	<input type="submit" value="上传">
	</form>
	</div>
</div>
<script type="text/javascript">
var editor = new baidu.editor.ui.Editor();
editor.render("t_area");  
function checkform(){
	if($("#title").val()==""){
		$.jBox.tip("标题不能为空");
		return;
	}
	if($("#classid").val()==""){
		$.jBox.tip("请选择分类");
		return;
	}
	editor.sync();
	$(".list_form").submit();
}
</script>
</body>
</html>
